﻿using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace DomSharp
{
    public partial class HtmlElement
    {
        private Expression expression;

        public HtmlElement(MethodCallExpression expression)
        {
            this.expression = expression;
        }

        public HtmlElement(ElementReference elementReference)
        {
            this.expression = Expression.Constant(this);
            ElementReference = elementReference;
        }
        public Style GetStyle()
        {
            return new Style(Expression.PropertyOrField(expression, nameof(Style)));
        }

        public ValueTask SetStyle(Style value)
        {
            return new DomQueryable(Expression.Assign(Expression.PropertyOrField(expression, "Style"), Expression.Constant(value))).Execute();
        }
        internal Style Style { get; set; }
        public ElementReference ElementReference { get; }
    }
}
